import request from '@/utils/request'

export function getCategoryList(params) {
  return request({
    url: '/category/page',
    method: 'get',
    params
  })
}

export function addCategory(params) {
  return request({
    url: '/category',
    method: 'post',
    data: { ...params }
  })
}

export function editCategory(params) {
  return request({
    url: '/category',
    method: 'put',
    data: { ...params }
  })
}

export function deleteCategory(id) {
  return request({
    url: '/category',
    method: 'delete',
    params: { id }
  })
}

export function queryCategoryById(id) {
  return request({
    url: `/category/${id}`,
    method: 'get'
  })
}
